//ドロップダウンメニュー
$.fn.droppy = function(options) {
options = $.extend({speed: 250}, options || {});
this.each(function() {
var root = this, zIndex = 1000;
function getSubnav(ele) {
if (ele.nodeName.toLowerCase() == 'li') {
var subnav = $('> ul', ele);
return subnav.length ? subnav[0] : null;
} else {
return ele;
}}
function getActuator(ele) {
if (ele.nodeName.toLowerCase() == 'ul') {
return $(ele).parents('li')[0];
} else {
return ele;
}}
function hide() {
var subnav = getSubnav(this);
if (!subnav) return;
$.data(subnav, 'cancelHide', false);
setTimeout(function() {
if (!$.data(subnav, 'cancelHide')) {
$(subnav).slideUp(options.speed);
}}, 500);}
function show() {
var subnav = getSubnav(this);
if (!subnav) return;
$.data(subnav, 'cancelHide', true);
$(subnav).css({zIndex: zIndex++}).slideDown(options.speed);
if (this.nodeName.toLowerCase() == 'ul') {
var li = getActuator(this);
$(li).addClass('hover');
$('> a', li).addClass('hover');
}}
$('ul, li', this).hover(show, hide);
$('li', this).hover(
function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); },
function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover'); }
);});};
$(function() {
$('#headerMenu ul').droppy();
});

//記事タイトルリンク
$(function(){
$("div.entry h3.title").wrapInner("<a></a>");
$('div.foot>a:first-child').each(function(i){
$("div.entry h3.title a").eq(i).attr("href",this.href);
});});

//スクロールトップ
var scrolltotop={
	//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
	//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
	setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
	controlHTML: '<img src="http://0nline.info/scrollup.png" style="width:48px; height:48px" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
	state: {isvisible:false, shouldvisible:false},
	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},
	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},
	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'Scroll Back to Top'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}
scrolltotop.init()

//ライトボックス
document.write(
'<link rel="stylesheet" href="http://0nline.info/lightbox/style/colorbox.css" type="text/css"/>\
<script type="text/javascript" src="http://0nline.info/lightbox/colorbox/jquery.colorbox.js"></script>');
$(document).ready(function(){
$('.lbox img').parents("a").attr({rel:"lbox"});
$('a[rel="lbox"]').colorbox();
$('a.youtube').colorbox({iframe:true, width:640, height:480});
});

//ソーシャル
(function($) {
$.fn.socialbutton = function(service, options) {
options = options || {};
var defaults = {
mixi_check: {
key: '',
button: 'button-1', // button-1,button-2,button-3,button-4,button-5
url: '' // document.URL
},
mixi_like: {
key: '',
url: document.URL,
width: 0, // auto
height: 0, // auto
show_faces: true,
style: '',
sizes: {
width: {
with_faces: 450,
without_faces: 140
},
height: {
with_faces_minimum: 80,
without_faces_minimum: 20
}
}
},
facebook_like: {
button: 'standard', // standard / button_count / box_count
url: document.URL,
show_faces: true,
width: 0, // auto
height: 0, // auto
width_standard_default: 450, // orig: 450
width_standard_minimum: 225,
height_standard_without_photo: 35,
height_standard_with_photo: 80,
width_button_count_default: 120, // orig: 90, jp_min: 114
width_button_count_minimum: 90,
height_button_count: 25, // orig:20, jp_min: 21
width_box_count_default: 80, // orig:55, jp_min: 75
width_box_count_minimum: 55,
height_box_count: 70, // orig: 65, jp_min: 66
action: 'like', // like / recommend
locale: '', // auto
font: '',
colorscheme: 'light' // light / dark
},
facebook_share: {
button: 'button_count', // box_count / button / icon_link / icon
url: '', //document.URL
text: '' //Share
},
twitter: {
button: 'vertical', // vertical / horizontal / none
url: '', // document.URL
text: '',
lang: 'ja', // ja / en /de / fr / es
via: '',
related: ''
},
gree_sf: {
button: 0, // 0,1,2,3,4
url: document.URL,
width: 0, // auto
height: 20,
widths: {
type0_16: 58, type0_20: 70, type0_23: 76,
type1_16: 58, type1_20: 73, type1_23: 78,
type2_16: 58, type2_20: 73, type2_23: 78,
type3_16: 49, type3_20: 61, type3_23: 64,
type4_16: 16, type4_22: 21, type4_32: 32
}
},
evernote: {
button: 'article-clipper', // article-clipper, article-clipper-remember, article-clipper-jp, article-clipper-rus, article-clipper-fr, article-clipper-es, article-clipper-de, article-clipper-vert, site-mem-32, site-mem-36, site-mem-22, site-mem-16
url: '', // document.URL
provider_name: '', // domain name
suggest_notebook: '', // notebook name
content_id: '', // element id for clip
code: '', // affiliate code
title: '',
suggest_tags: '',
styling: '' // none(text-only), full
},
hatena: {
button: 'standard', // standard, vertical, simple
url: document.URL,
title: document.title
},
hatena_oldstyle: {
button: 'http://d.hatena.ne.jp/images/b_append.gif',
url: document.URL,
height: 13,
padding: 7
}
};
var max_index = this.size() - 1;
return this.each(function(index) {
switch (service) {
case 'mixi_check':
socialbutton_mixi_check(this, options, defaults.mixi_check, index, max_index);
break;
case 'mixi_like':
socialbutton_mixi_like(this, options, defaults.mixi_like, index, max_index);
break;
case 'facebook_like':
socialbutton_facebook_like(this, options, defaults.facebook_like, index, max_index);
break;
case 'facebook_share':
socialbutton_facebook_share(this, options, defaults.facebook_share, index, max_index);
break;
case 'twitter':
socialbutton_twitter(this, options, defaults.twitter, index, max_index);
break;
case 'gree_sf':
socialbutton_gree_sf(this, options, defaults.gree_sf, index, max_index);
break;
case 'evernote':
socialbutton_evernote(this, options, defaults.evernote, index, max_index);
break;
case 'hatena':
socialbutton_hatena(this, options, defaults.hatena, index, max_index);
break;
case 'hatena_oldstyle':
socialbutton_hatena_oldstyle(this, options, defaults.hatena_oldstyle, index, max_index);
break;
default:
break;
}
return true;
});
}
function socialbutton_mixi_check(target, options, defaults, index, max_index)
{
var key = options.key || defaults.key;
var button = options.button || defaults.button;
var url = options.url || defaults.url;
if (key == '') {
return;
}
var attr = merge_attributes({
'data-key': key,
'data-url': htmlspecialchars(url),
'data-button': button
});
var tag = '<a href="http://mixi.jp/share.pl" class="mixi-check-button"' + attr + '>Check</a>';
$(target).html(tag);
if (index == max_index) {
$('body').append('<script type="text/javascript" src="http://static.mixi.jp/js/share.js"></script>');
}
}
function socialbutton_mixi_like(target, options, defaults, index, max_index)
{
var key = options.key || defaults.key;
var url = options.url || defaults.url;
var width = options.width != undefined ? options.width : defaults.width;
var height = options.height != undefined ? options.height : defaults.height;
var show_faces = options.show_faces != undefined ? options.show_faces : defaults.show_faces;
var style = options.style || defaults.style;
if (key == '') {
return;
}
if (options.url) {
url = decodeURIComponent(url);
}
url = url_encode_rfc3986(url);
if (width == 0) {
width = show_faces ? defaults.sizes.width.with_faces : defaults.sizes.width.without_faces;
}
if (height == 0) {
height = show_faces ? defaults.sizes.height.with_faces_minimum : defaults.sizes.height.without_faces_minimum;
} else {
if (show_faces && height < defaults.sizes.height.with_faces_minimum) {
height = defaults.sizes.height.with_faces_minimum;
} else if (!show_faces && height < defaults.sizes.height.without_faces_minimum) {
height = defaults.sizes.height.without_faces_minimum;
}
}
var params = merge_parameters({
'href': url,
'service_key': key,
'width': width,
'show_faces': show_faces ? 'true' : 'false'
});
var attr = merge_attributes({
src: 'http://plugins.mixi.jp/favorite.pl?' + params,
scrolling: 'no',
frameborder: '0',
allowTransparency: 'true',
style: 'border:0; overflow:hidden; width:' + width + 'px; height:' + height + 'px; ' + style
});
var tag = '<iframe' + attr + '></iframe>';
$(target).html(tag);
}
function socialbutton_facebook_like(target, options, defaults, index, max_index)
{
var layout = options.layout || options.button || defaults.button;
var url = options.url || defaults.url;
var show_faces = options.show_faces != undefined ? options.show_faces : defaults.show_faces;
var width = options.width != undefined ? options.width : defaults.width;
var height = options.height != undefined ? options.height : defaults.height;
var action = options.action || defaults.action;
var locale = options.locale || defaults.locale;
var font = options.font || defaults.font;
var colorscheme = options.colorscheme || defaults.colorscheme;
if (options.url) {
url = decodeURIComponent(url);
}
url = url_encode_rfc3986(url);
switch (layout) {
case 'standard':
if (width == 0) {
width = defaults.width_standard_default;
} else if (width < defaults.width_standard_minimum) {
width = defaults.width_standard_minimum;
}
if (height == 0) {
height = show_faces ? defaults.height_standard_with_photo : defaults.height_standard_without_photo;
} else if (height < defaults.height_standard_without_photo) {
height = defaults.height_standard_without_photo;
}
break;
case 'button_count':
if (width == 0) {
width = defaults.width_button_count_default;
} else if (width < defaults.width_button_count_minimum) {
width = defaults.width_button_count_minimum;
}
if (height == 0) {
height = defaults.height_button_count;
} else if (height < defaults.height_button_count) {
height = defaults.height_button_count;
}
break;
case 'box_count':
if (width == 0) {
width = defaults.width_box_count_default;
} else if (width < defaults.width_box_count_minimum) {
width = defaults.width_box_count_minimum;
}
if (height == 0) {
height = defaults.height_box_count;
} else if (height < defaults.height_box_count) {
height = defaults.height_box_count;
}
break;
}
var params = merge_parameters({
'href': url,
'layout': layout,
'show_faces': show_faces ? 'true' : 'false',
'width': width,
'action': action,
'locale': locale,
'font': font,
'colorscheme': colorscheme,
'height': height
});
var tag = '<iframe src="http://www.facebook.com/plugins/like.php?' + params + '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' + width + 'px; height:' + height + 'px;" allowTransparency="true"></iframe>';
$(target).html(tag);
}
function socialbutton_facebook_share(target, options, defaults, index, max_index)
{
var type = options.type || options.button || defaults.button;
var url = options.url || defaults.url;
var text = options.text || defaults.text;
var attr = merge_attributes({
'type': type,
'share_url': htmlspecialchars(url)
});
var tag = '<a name="fb_share"' + attr + '>' + text + '</a>';
if(index == 0) {
tag += '<script type="text/javascript" src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"></script>';
}
$(target).html(tag);
}
function socialbutton_twitter(target, options, defaults, index, max_index)
{
var count = options.count || options.button || defaults.button;
var url = options.url || defaults.url;
var text = options.text || defaults.text;
var lang = options.lang || defaults.lang;
var via = options.via || defaults.via;
var related = options.related || defaults.related;
var attr = merge_attributes({
'data-count': count,
'data-url': htmlspecialchars(url),
'data-text': text,
'data-lang': lang,
'data-via': via,
'data-related': related
});
var tag = '<a href="http://twitter.com/share" class="twitter-share-button"' + attr + '>Tweet</a>';
$(target).html(tag);
if (index == max_index) {
$('body').append('<script type="text/javascript" charset="utf-8" src="http://platform.twitter.com/widgets.js"></script>');
}
}
function socialbutton_gree_sf(target, options, defaults, index, max_index)
{
var type = options.type || options.button || defaults.button;
var url = options.url || defaults.url;
var width = options.width != undefined ? options.width : defaults.width;
var height = options.height != undefined ? options.height : defaults.height;
if (options.url) {
url = decodeURIComponent(url);
}
url = url_encode_rfc3986(url);
switch (type) {
case 0:
case 1:
case 2:
case 3:
if (height != 16 && height != 20 && height != 23) {
height = 20;
}
break;
case 4:
if (height != 16 && height != 22 && height != 32) {
height = 22;
}
break;
default:
type = 0;
width = 0;
height = 20;
break;
}
if (width == 0) {
width = defaults.widths['type' + type + '_' + height];
}
var params = merge_parameters({
'url': url,
'type': String(type),
'height': height
});
var tag = '<iframe src="http://share.gree.jp/share?' + params + '" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" style="border:none; overflow:hidden; width:' + width + 'px; height:' + height + 'px;" allowTransparency="true"></iframe>';
$(target).html(tag);
}
function socialbutton_evernote(target, options, defaults, index, max_index)
{
var button = options.button || defaults.button;
var url = options.url || defaults.url;
var provider_name = options.provider_name || defaults.provider_name;
var suggest_notebook = options.suggest_notebook || defaults.suggest_notebook;
var content_id = options.content_id || defaults.content_id;
var code = options.code || defaults.code;
var title = options.title || defaults.title;
var suggest_tags = options.suggest_tags || defaults.suggest_tags;
var styling = options.styling || defaults.styling;
if (button == 'article-clipper' ||
button == 'article-clipper-remember' ||
button == 'article-clipper-jp' ||
button == 'article-clipper-rus' ||
button == 'article-clipper-fr' ||
button == 'article-clipper-es' ||
button == 'article-clipper-de' ||
button == 'article-clipper-vert' ||
button == 'site-mem-32' ||
button == 'site-mem-36' ||
button == 'site-mem-22' ||
button == 'site-mem-16'
) {
button = 'http://static.evernote.com/' + button + '.png';
}
var clipoptions = {
'url': url,
'providerName': provider_name,
'suggestNotebook': suggest_notebook,
'contentId': content_id,
'code': code,
'title': title,
'suggestTags': suggest_tags,
'styling': styling
};
if (index == 0) {
$('body').append('<script type="text/javascript" src="http://static.evernote.com/noteit.js"></script>');
}
var tag = $(document.createElement('a'))
.attr({href: '#'})
.click(function(){
if (Evernote) {
Evernote.doClip(clipoptions);
}
return false;
})
.append('<img src="' + button + '" alt="Clip to Evernote" style="border: none" />');
$(target).html(tag);
}
function socialbutton_hatena(target, options, defaults, index, max_index)
{
var layout = options.layout || options.button || defaults.button;
var url = options.url || defaults.url;
var title = options.title || defaults.title;
url = htmlspecialchars(url);
title = htmlspecialchars(title);
var attr = merge_attributes({
'href': 'http://b.hatena.ne.jp/entry/' + url,
'class': 'hatena-bookmark-button',
'data-hatena-bookmark-title': title,
'data-hatena-bookmark-layout': layout,
'title': '縺薙&#65533;繧ｨ繝ｳ繝医Μ繝ｼ繧偵&#65533;縺ｦ縺ｪ繝悶ャ繧ｯ繝槭&#65533;繧ｯ縺ｫ霑ｽ蜉'
});
var tag = '<a' + attr + '><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="縺薙&#65533;繧ｨ繝ｳ繝医Μ繝ｼ繧偵&#65533;縺ｦ縺ｪ繝悶ャ繧ｯ繝槭&#65533;繧ｯ縺ｫ霑ｽ蜉" width="20" height="20" style="border: none;" /></a>'
+ '<script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>';
$(target).html(tag);
}
function socialbutton_hatena_oldstyle(target, options, defaults, index, max_index)
{
var button = options.button || defaults.button;
var url = options.url || defaults.url;
var height = options.height != undefined ? options.height : defaults.height;
var padding = options.padding != undefined ? options.padding : defaults.padding;
url = htmlspecialchars(url);
var tag = '<span style="font-size: ' + height + 'px; line-height: 100%; ">'
+ '<span style="padding-right: ' + padding + 'px"><a href="http://b.hatena.ne.jp/entry/add/' + url + '" target="_blank"><img src="' + button + '" style="border: none; vertical-align: text-bottom" /></a></span>'
+ '<a href="http://b.hatena.ne.jp/entry/' + url + '" target="_blank"><img src="http://b.hatena.ne.jp/entry/image/' + url + '" style="border: none; vertical-align: text-bottom" /></a>'
+ '</span>';
$(target).html(tag);
}
function merge_attributes(attr)
{
var merged = '';
for (var i in attr) {
if (attr[i] == '') {
continue;
}
merged += ' ' + i + '="' + attr[i] + '"';
}
return merged;
}
function merge_parameters(params)
{
var merged = '';
for (var i in params) {
if (params[i] == '') {
continue;
}
merged += merged != '' ? '&amp;' : '';
merged += i + '=' + params[i] + '';
}
return merged;
}
function htmlspecialchars(string)
{
var table = [
[/&/g, '&amp;'],
[/</g, '&lt;'],
[/>/g, '&gt;'],
[/"/g, '&quot;'],
[/'/g, '&#039;']
];
for (var i in table) {
string = string.replace(table[i][0], table[i][1]);
}
return string;
}
function url_encode_rfc3986(url)
{
return encodeURIComponent(url).replace(/[!*'()]/g, function(p) {
return "%" + p.charCodeAt(0).toString(16);
});
}
})(jQuery);

function facebook_like(e) {
  $('.socialbuttons', e).append('<div class="socialbutton fblike"></div>');
  var b = $('.fblike', e);
  var url = $('.foot a[href^="http://ameblo.jp/"],.foot a[href^="http://secret.ameba.jp/"]', $(e)).attr('href');
  $(b).socialbutton('facebook_like', {
    button: 'button_count',
    url: url,
    width: 150
  });
}

function facebook_share(e) {
  $('.socialbuttons', e).append('<div class="socialbutton fbshare"></div>');
  var b = $('.fbshare', e);
  var url = $('.foot a[href^="http://ameblo.jp/"],.foot a[href^="http://secret.ameba.jp/"]', $(e)).attr('href');
  $(b).socialbutton('facebook_share', {
    button: 'button_count',
    url: url,
    text: '繧ｷ繧ｧ繧｢'
  });
}

function twitter(e) {
  $('.socialbuttons', e).append('<div class="socialbutton twitter"></div>');
  var b = $('.twitter', e);
  var url = $('.foot a[href^="http://ameblo.jp/"],.foot a[href^="http://secret.ameba.jp/"]', $(e)).attr('href');
  var text = $('h3.title', e).text() + ' | ' + $('h1').text();
  $(b).socialbutton('twitter', {
    button: 'horizontal',
    url: url,
    text: text,
    via: (typeof(viaTwitterUser) == 'undefined' ? '' : viaTwitterUser)
  });
}

function hatena_bm(e) {
  $('.socialbuttons', e).append('<div class="socialbutton hatenabm"></div>');
  var b = $('.hatenabm', e);
  var url = $('.foot a[href^="http://ameblo.jp/"],.foot a[href^="http://secret.ameba.jp/"]', $(e)).attr('href');
  var title = $('h3.title', e).text() + ' | ' + $('h1').text();
  $(b).socialbutton('hatena', {
    button: 'standard',
    url: url,
    title: title
  });
}

function plusone(e){eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(\'.f\',e).5(\'<6 g="h 7"></6>\');1 b=$(\'.7\',e);1 2=$(\'.8 a[3^="4://i.9/"],.8 a[3^="4://j.k.9/"]\',$(e)).l(\'3\');1 c=\'<d m="0" n="o" p="q" r="0" s="0" t="u" v="w" x="4://y.z.A/B?2=\'+C(2)+\'"></d>\';$(b).5(c);',39,39,'|var|url|href|http|append|div|plusone|foot|jp|||tag|iframe||socialbuttons|class|socialbutton|ameblo|secret|ameba|attr|frameborder|width|75|height|20|marginwidth|marginheight|scrolling|no|allowtransparency|true|src|wazameba|appspot|com|plus1|escape'.split('|'),0,{}))}

function socialbuttons(options) {
  var opt       = ((typeof(options)       == 'undefined') ? {}    : options);
  var position  = ((typeof(opt.position)  == 'undefined') ? 'end' : opt.position);
  var instantly = ((typeof(opt.instantly) == 'undefined') ? false : opt.instantly);
  var buttons   = ((typeof(opt.buttons)   == 'undefined') ? []    : opt.buttons);
  
  if (position == 'top_r' || position == 'end_r' || position == 'foot_r') {
    $('body').prepend('<style>.socialbuttons .socialbutton{float:right;margin-right:2px}</style>');
  } else if (position == 'foot_rr') {
    $('body').prepend('<style>.socialbuttons .socialbutton{float:right;margin-left:2px}</style>');
  } else {
    $('body').prepend('<style>.socialbuttons .socialbutton{float:left;margin-right:2px}</style>');
  }
  
  var f = function() {
    $('div.entry').each(function(i, e){
      if ($('.socialbuttons', e).length == 0) {
        switch (position) {
          case 'top':
          case 'top_r':
            $('.contents .subContents', e).prepend('<div class="socialbuttons"></div>');
            break;
          case 'end':
          case 'end_r':
            $('.contents .subContents', e).append('<div class="socialbuttons"></div>');
            break;
          case 'foot':
          case 'foot_r':
            $('.foot', e).wrapInner('<div style="float:right"></div>');
            $('.foot', e).wrapInner('<div class="socialbuttons"></div>');
            break;
          case 'foot_rr':
            $('.foot', e).wrapInner('<div style="float:right"></div>');
            $('.foot', e).prepend('<div class="socialbuttons" style="float:right"></div>');
            break;
        }
        flg = true;
      }
      for (var i = 0; i < buttons.length; i++) {
        switch (buttons[i]) {
          case 'hatenabm':
            hatena_bm(e);
            break;
          case 'twitter':
            twitter(e);
            break;
          case 'fbshare':
            facebook_share(e);
            break;
          case 'fblike':
            facebook_like(e);
            break;
          case 'plusone':
            plusone(e);
            break;
        }
      }
      $('.socialbuttons', e).append('<div class="clearFix"></div>');
    });
  }
  if (typeof(instantly) != 'undefined' && instantly) {
    f();
  } else {
    $(function(){f();});
  }
}

socialbuttons({buttons:['hatenabm','twitter','plusone']});

//LinkWithinをAdより上に表示
var lwdiv = '<div class="linkwithin_div"></div>';
var adv2s = "#advertising2,.advertising2";
$("div.entry .subContents").each(function(i, E) {
if ($(adv2s, E).length) {
$(adv2s, E).before(lwdiv);
} else {
$(E).append(lwdiv);}});

//記事下定型文
var myMe ='コメント貰っても返すかわかりません'
$(function() {
$(".entry .foot").before('<div class="fix">'+ myMe + '</div>');
});

//コメントプラグイン


//コメント色分け
$(function(){
var url = location.href.replace(/^(http\:\/\/ameblo\.jp\/[^\/]+).*$/,'$1');
$('.each_comment:has(.comment_author a[href="'+url+'/"])')
.addClass('admin_comment');});